<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="Microsoft FrontPage 5.0">
<TITLE>DirectMusic</TITLE>
<META NAME="Template" CONTENT="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
</HEAD>
<BODY TEXT="#000000" LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff" leftmargin="8">
<FONT FACE="Verdana"><H2><A NAME="MYSAMPLE">DirectMusic Software Synthesizer</A> </H2>

<H3>Summary</H3></FONT><FONT FACE="Verdana" SIZE=2><P>

This sample contains working source code for a kernel-mode software synthesizer that plugs
into the Microsoft&#174; DirectMusic&#174; and WDM Audio architectures.<P>

<H3>Building a new DirectMusic Synthesizer</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
You are encouraged to use this sample code to start building your own software
synthesizer. Modify the sample to add your own features.<P>

If you ship your synthesizer to customers, be sure to use the Guidgen program to create
a Globally Unique ID (GUID) for your synthesizer so it won't interfere with other
synthesizers. Set CLSID_DDKWDMSynth at the top of private.h and ddksynth.inf to be your 
GUID. You should also set the text in miniport.cpp, ddksynth.rc and ddksynth.inf to 
describe your synthesizer.<P>

Note: this is a software synthesizer sample, but is also relevant as a hardware driver 
sample.  If you are writing a hardware driver, you should 1) not implement the wave pin,
2) not implement a synthsink nor depend on Render being called from the port (the
hardware should notify the miniport if it needs additional work done at buffer render
time), and 3) use category RENDER instead of DATATRANSFORM.


<H3>Creating a User-mode Synthesizer </H3></FONT><FONT FACE="Verdana" SIZE=2><P>
Although this sample doesn't show you how to create a user-mode synthesizer, you can start 
with the user-mode sample to feel out how synthesis and DLS downloads work. We recommend that
you try out your ideas and get things working in user-mode before moving to kernel mode. 
This approach might be easier and save a bit of debugging time.<P>

<H3>Building the Sample</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
Open a free or checked DDK build environment, go to the sample directory, and run <B>build</B>.
This creates ddksynth.sys in the Objfre or Objchk subdirectories. Before the sample can
be used, it must be installed by executing <B>ddksynth.inf</B>.<P>

<H3>Testing the Synthesizer</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
To test the synthesizer, open DirectMusic Producer and open the Port Configuration window.
(You can do this by right-clicking the button showing a 1 or 2 with a sound wave behind it on the
Transit Controls toolbar.)  The port name dropdown will now contain the option <B>Microsoft DDK 
Synthesizer (WDM)</B> in addition to the Microsoft Synthesizer (WDM) option. Set one of the
configurations to use the Microsoft DDK Synthesizer port.<P>

Then, when you play music through that configuration, it will be played by the synthesizer
you built from the DDK sample. The sound and capabilities of the DDK sample -- Microsoft DDK
Synthesizer (WDM) -- are virtually identical to the kernel-mode DirectMusic synthesizer -- 
Microsoft Synthesizer (WDM).  One major exception is that the DDK sample synthesizer does not 
support reverb.<P>

<H3>Supported Configurations</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
The DDK sample synthesizer has been tested in checked and free builds with Microsoft Visual C++&#174;
version 6.  It has been tested on Alpha, but not on 64-bit platforms.<P>

Plug and Play as well as Power Management are supported by PortCls on behalf of the synthesizer.<P>

<H3>CODE TOUR</H3>
<H4>File Manifest</H4>
</FONT><U><PRE>File&#9;&#9;	Description
</U>
adapter.cpp&#9;	Implementation of WDM adapter
clist.cpp&#9;	Implements a simple list data structure
clist.h	&#9;	Prototypes for clist.cpp
common.h&#9;	Master header file 
control.cpp&#9;	CControlLogic implementation 
csynth.cpp&#9;	CSynth implementation
csynth.h&#9;	Prototypes for csynth.cpp
DDKSynth.rc&#9;	Resources file containng version information
instr.cpp&#9;	Implements instruments
kernhelp.cpp&#9;	Helper functions to keep code common between user and kernel modes
kernhelp.h&#9;	Prototype file for kernhelp.h
makefile&#9;	Makefile for BUILD environment
midi.cpp&#9;	Implements MIDI events
miniport.cpp&#9;	Implementation of WDM miniport
mix.cpp&#9;		CDigitalAudio mixing functions
mmx.cpp&#9;		MMX-optimized mixing functions
muldiv32.h&#9;	High-resolution multiply-divide operations
plclock.cpp&#9;	Clock implementation
plclock.h&#9;	Prototypes for plclock.cpp
private.h&#9;	Prototypes for adapter.cpp, miniport.cpp, and syslink.cpp
sources&#9;		Sources file for BUILD environment 
synth.h&#9;		Prototypes for instr.cpp, midi.cpp, voice.cpp, and control.cpp
syslink.cpp&#9;	Wave interface back into PortCls
voice.cpp&#9;	Voice implementation




</FONT><P ALIGN="CENTER"><A HREF="#top"><FONT FACE="Verdana" SIZE=2>Top of page</FONT></A><FONT FACE="Verdana" SIZE=2> </P></FONT>
<TABLE CELLSPACING=0 BORDER=0 WIDTH=624>
<TR><TD VALIGN="MIDDLE" BGCOLOR="#00ffff" HEIGHT=2>
<P></TD>
</TR>
</TABLE>

<FONT FACE="MS Sans Serif" SIZE=1><P>&copy; 1999-2000 Microsoft Corporation. All rights reserved.</FONT><FONT FACE="Verdana" SIZE=2> </P></FONT></BODY>
</HTML>
